<template>
	<view>
		<uni-popup ref="showpeizhi" @change="upclose" mode="center">
			<view class="bgfff ra15 width1440 posire pt30 ">
				<view class="flex-ju-c size36 color333 bold border-bebecef pb30">{{sindex==0?'应用配置':sindex==1?'入会视频':sindex==2?'入会音频':sindex==3?'监控设置':'关于'}}</view>
				<image @click="$refs.showpeizhi.close()" mode="widthFix" class="image posiab right30 top30 width50"
					src="/static/img/bi.png"></image>
				<view class="flex size28">
					<view class="bgfafafa height900">
						<view v-for="(item,p) in seeting" :key="p" @click="tapseeting(p)"
							:class="sindex==p?'bge0eaff':''" class="flex-a-i wh240-104 pl40  hover">
							<image mode="widthFix" class="image mr15 width40 " :src="item.img"></image>
							{{item.text}}
						</view>
					</view>

					<view v-if="sindex == 0" class="mt20  pb50 width1000">
						<view class="size28 color333  flex-a-i   ml40">
							<view class="wh6-30 mt8 bg2C7BFF mr15"></view>已添加功能<text class="color999">（拖动可排序）</text>
						</view>

						<scroll-view style="max-height:700rpx;" class=" scroll-view" scroll-y>
							<DraggableList :list="navItemsUse" @update="onListUpdate">
								<template #item="{item, index}">
									<view class="drag-items">
										<view class="drag-item  flex-ju-b">
											<view class="flex-a-i">
												<view class="width58">
													<image v-if="navItemsUse.length>2" src="/static/index/del_icon.png" mode="widthFix" class="del-icon"
														@click="delItem(index)"></image>
												</view>
												
												<view class="flex-a-i ">
													<image :src="IMGURL+item.filePath" mode="widthFix" class="icon">
													</image>
													<text class="flex1"> {{ item.name }}</text>
												</view>
											</view>
											<image src="/static/index/drag.png" mode="widthFix" class="drag-icon">
											</image>
										</view>
									</view>
								</template>
							</DraggableList>
						</scroll-view>

						<view class="size28 color333 ml40 flex-a-i  mb40 mt50 ">
							<view class="wh6-30 mt8 bg2C7BFF mr15"></view>未添加功能
						</view>

						<view class="drag-items">
							<scroll-view style="max-height:300rpx;" class=" scroll-view" scroll-y>
								<view class="drag-item mb20 flex-ju-b" v-for="(item, index) in navItemsNoUse"
									:key="index">
									<view class="flex-a-i">
										<image src="/static/img/jia.png" mode="widthFix" class="del-icon"
											@click="addItem(index)"></image>
										<view class="flex-a-i ">
											<image :src="IMGURL+item.filePath" mode="widthFix" class="icon"></image>
											<text class="flex1"> {{ item.name }}</text>
										</view>
									</view>
									<image src="/static/index/drag.png" mode="widthFix" class="drag-icon"></image>
								</view>
							</scroll-view>

						</view>

						<view class="border-teeeff1 mt30">
							<view class="flex-row mr60 mt30">
								<view class="flex-a-i ">
									<view @click="$refs.showpeizhi.close()" class="wh152-64 borderd0d6dc flex-ju-c ra5">
										取消
									</view>
									<view @click="save"
										class="wh152-64 border165FFF colorfff bg165FFF flex-ju-c ml60 ra5">确定</view>
								</view>
							</view>
						</view>
					</view>

					<view v-else-if="sindex == 1" class="mt20 pb50 ml40">
						<view class="bgdddddd wh1044-608 ra20 flex-ju-c">
							<VIDEO v-if="videoLsitValue" id="previewVideo" style="height:100%;" class="width1000">
							</VIDEO>
							<image v-else mode="widthFix" class="image mr15 width152 " src="/static/img/noshe.png">
							</image>
						</view>
						<view class="flex-a-i mt50">
							<view style="white-space: nowrap;">本地视频：</view>

							<template v-if="videoLsitValue">
								<uni-data-select style="width:650rpx;text-align: left;z-index: 20;"
									:localdata="videoLsit" :clear="false" @change="videoSelect"
									v-model="videoLsitValue">
								</uni-data-select>
							</template>

							<template v-else>
								<el-input disabled placeholder="未检测到摄像头设备" />
							</template>

						</view>
						<view class="flex-a-i mt50 mb30">
							<view style="white-space: nowrap;">清晰度：</view>

							<uni-data-select v-model="mioptionvalue" :clear="false"
								style="width: 240px;text-align: left;" :localdata="optionCam"
								@change="changepicker"></uni-data-select>
						</view>

						<view class="text-left">
							<el-checkbox label="本地视频镜像" @change="ISmirror" v-model="checkboxCam" size="large" />
							<view class=""> </view>
							<el-checkbox label="入会时关闭摄像头" @change="TAPiscam" v-model="iscam" size="large" />
						</view>


					</view>
					<view v-else-if="sindex == 2" class="mt20  pb50 ml40">
						<view class="size28 color333  flex-a-i  mb40 bold">
							<view class="wh6-30  bg2C7BFF mr15"></view>麦克风
						</view>
						<view class="flex-a-i color333">
							选择设备：
							<template v-if="audioinputValue">
								<uni-data-select style="width:650rpx;text-align: left;" :localdata="audioinput"
									:clear="false" @change="camSelect" v-model="audioinputValue">
								</uni-data-select>

							</template>
							<template v-else>
								<el-select v-model="audioinputValue" disabled placeholder="未检测到麦克风"
									style="width:650rpx">
								</el-select>
							</template>

							<el-button type="primary" @click="micphone" class="bg165DFF ml20">检测麦克风</el-button>
						</view>

						<view class="flex-a-i mt30 mb10 color333">
							输入等级：<image mode="widthFix" class="image  width32" src="/static/img/mfeng.png"></image>
							<el-slider @change="elSlider" style="width:600rpx" class="ml20" v-model="defslider"
								:step="10" show-stops />
						</view>
						<view class="text-left">
							<el-checkbox label="入会时关闭麦克风" v-model="ismic" @change="changemic" class="color333"
								size="large" />
						</view>


						<view class="size28 color333  flex-a-i mt20 mb40 bold">
							<view class="wh6-30  bg2C7BFF mr15"></view>扬声器
						</view>
						<view class="flex-a-i color333">
							选择设备：

							<uni-data-select style="width:650rpx;text-align: left;" :localdata="audiooutput"
								:clear="false" @change="micSelect" v-model="audiooutputValue">

							</uni-data-select>

							<!-- 	<el-select @change="micSelect" v-model="audiooutputValue" placeholder="默认"
								style="width:650rpx">
								<el-option v-for="item in audiooutput" :key="item.device_id" :label="item.label"
									:value="item.device_id" />
							</el-select> -->
							<!-- <el-button @click="playAudio" type="primary" class="bg165DFF ml20">检测扬声器</el-button> -->
						</view>

						<view class="flex-a-i color333">
							输出音量：
							<slider class="width500 " :value="slidervaluemic" @change="sliderChange" show-value />
						</view>

						<view class="size28 color333  flex-a-i mt20 mb40 bold">
							<view class="wh6-30  bg2C7BFF mr15"></view>音频处理
						</view>
						<view class="text-left">
							<el-checkbox label="回声消除" @change="tapEliminate" v-model="eliminate" class="color333"
								size="large" />
						</view>
						<view class="text-left">
							<el-checkbox label="自动增益控制" @change="tapGain" v-model="gain" class="color333"
								size="large" />
						</view>
						<view class="text-left">
							<el-checkbox label="自动噪音抑制" @change="tapNoise" v-model="noise" class="color333"
								size="large" />
						</view>

					</view>

					<view v-else-if="sindex == 3" style="min-width:1000rpx;" class="mt20  pb50 ml40">
						<view class="size28 color333  flex-a-i  mb40 bold">
							<view class="wh6-30  bg2C7BFF mr15"></view>基本配置
						</view>
						<view class="flex-a-i mb30">
							<view class="flex-a-i">
								<view class="width170">启动窗口数：</view>
								<uni-data-select v-model="winVlaue" class="width300 " style="z-index:20;" :clear="false"
									:localdata="win_number" @change="changWinNumber"></uni-data-select>
							</view>

							<view class="flex-a-i">
								<view class="ml100">码流类型：</view>

								<uni-data-select v-model="typeVlaue" class="width300 " :clear="false"
									:localdata="flow_type" @change="changeFlowType"></uni-data-select>
							</view>

						</view>


						<view class="flex-ju-b">
							<el-checkbox label="报警声音" v-model="box_alarm" class="color333" size="large" />
							<view class="flex-a-i">
								报警声音关闭(秒)：
								<view class="width240">
									<el-input class="" v-model="alarm_value" placeholder=""></el-input>
								</view>
							</view>
						</view>

						<view class="flex-ju-b">
							<el-checkbox label="即时回放" v-model="box_playback" class="color333" size="large" />
							<view class="flex-a-i">
								即时回放时间(秒)：
								<view class="width240">
									<el-input class="" v-model="playback_value" placeholder=""></el-input>
								</view>
							</view>
						</view>
						<view class="flex-ju-b">
							<el-checkbox label="持续获取云台位置" v-model="box_position" class="color333" size="large" />
							<el-checkbox label="报警联动提示" v-model="box_prompt" class="color333 mr270" size="large" />
						</view>

						<view class="size28 color333  flex-a-i mt20 mb40 bold">
							<view class="wh6-30  bg2C7BFF mr15"></view>抓图设置
						</view>

						<view class="flex-ju-b">
							<view class="flex-a-i">
								<view class="width170">图片格式：</view>
								<view class="width300">
									<uni-data-select v-model="imgVlaue" :clear="false" :localdata="img_data"
										@change="changeIMG"></uni-data-select>
								</view>

							</view>

							<view class="flex-a-i">
								<view class="ml100">连续抓图(张)：</view>
								<view class="width256">
									<el-input v-model="link_img_num" placeholder="" class=""></el-input>
								</view>
							</view>

						</view>

						<view class="flex-a-i mt30">
							<view class="">连续抓图间隔(秒)：</view>
							<view class="width256">
								<el-input placeholder="" v-model="link_img_second" class=""></el-input>
							</view>
						</view>

						<view class="flex-a-i mt30">
							<view class="">抓图保存路径：</view>
							<view class="width560">
								<el-input placeholder="" v-model="IMG_PATH" disabled class=" "></el-input>
							</view>
							<view @click="onImgPath" class="wh124-64 flex-ju-c ra5 color333 bgEBECEF ml15">更改</view>
						</view>

						<view class="size28 color333  flex-a-i mt20 mb40 bold mt40 pt40 border-tf5f7fa">
							<view class="wh6-30  bg2C7BFF mr15"></view>录像/下载设置
						</view>
						<view class="flex-a-i mt30">
							<view class="">最大录像时间(分)：</view>
							<view class="width256">
								<el-input v-model="max_time_video" placeholder="" class=""></el-input>
							</view>
						</view>
						<view class="flex-a-i mt30">
							<view class="">录像保存路径：</view>
							<view class="width560">
								<el-input placeholder="" v-model="vodel_path" disabled class=""></el-input>
							</view>
							<view @click="onVideoPath" class="wh124-64 flex-ju-c ra5 color333 bgEBECEF ml15">更改</view>
						</view>

						<view class="border-teeeff1 mt100">
							<view class="flex-row mr60 mt50">
								<view class="flex-a-i ">
									<!-- <view @click="" class="wh152-64 borderd0d6dc flex-ju-c ra5">默认配置
									</view> -->
									<view @click="monitorSave"
										class="wh152-64 border165FFF colorfff bg165FFF flex-ju-c ml60 ra5">确定</view>
								</view>
							</view>
						</view>

					</view>

					<view v-else class="mt20 flex-ju-c pb50 width1000 flex-col ">
						<view class=" ">
							<image mode="widthFix" class="image  width128" src="/static/img/imgguanyu.png"></image>
						</view>
						<view class="color333 size32 bold mt50">融合视讯调度平台</view>
						<view class="color666 size28 mt40">当前版本v{{version}}</view>
						<view @click="onUpdate" class=" size26 mt40 wh200-60 flex-ju-c bg165FFF  colorfff">检查更新</view>
					</view>

				</view>
			</view>
		</uni-popup>
		<uni-popup ref="upDate">
			<view class="posire">
				<view class="posiab  height400 flex-ju-c width1000 flex-col">
					<view class="size50 bold">检测到新版本{{upversion}}</view>
					<view class="mt30 mb30">{{text}}</view>
					<el-button :loading="loading" class="bg165FFF wh230-80" @click="download" type="primary">{{but_text}}</el-button>
				</view>
				<image mode="heightFix"  class="image height400 " src="/static/img/upimg.png"></image>
			</view>
		</uni-popup>
	</view>
</template>

<script>
	export default {
		name: "configuration",
		props: ['IMGURL'],
		data() {
			return {
				upurl:"",
				text:"新版本已准备好，是否下载",
				versionData:"",
				upversion:"",
				but_text:"立即下载",
				loading:false,
				vodel_path: "",
				version:"",
				IMG_PATH: "",
				max_time_video: "",
				link_img_second: "",
				link_img_num: "",
				imgVlaue: "",
				img_data: [{
						label: "jpg",
						value: "1"
					},
					{
						label: "png",
						value: "2"
					},
				],
				box_alarm: "",
				alarm_value: "",
				box_playback: "",
				playback_value: "",
				box_position: "",
				box_prompt: "",
				typeVlaue:"1",
				flow_type: [{
						label: "主码流",
						value: "1"
					},
					{
						label: "子码流",
						value: "2"
					}
				],
				winVlaue: '1',
				win_number: [{
						label: '1分屏',
						value: '1'
					},
					{
						label: '4分屏',
						value: '2'
					},
					{
						label: '6分屏',
						value: '3',
					},
					{
						label: '8分屏',
						value: '4',
					},
					{
						label: '9分屏',
						value: '5',
					},
					{
						label: '13分屏',
						value:' 6',
					},
					{
						label: '15分屏',
						value: '7',
					},
					{
						label: '16分屏',
						value:' 8',
					},
					{
						label: '20分屏',
						value: '9',
					},
					{
						label: '25分屏',
						value: '10',
					},
					{
						label: '32分屏',
						value:'11',
					},
					{
						label: '36分屏',
						value: '12',
					},
					{
						label: '64分屏',
						value: '13',
					}
				],
				sindex: 2,
				seeting: [{
						img: "/static/img/peizhi.png",
						text: "应用配置"
					},
					{
						img: "/static/img/ruhui.png",
						text: "入会视频"
					},
					{
						img: "/static/img/yinping.png",
						text: "入会音频"
					},
					{
						img: "/static/img/jiankong.png",
						text: "监控设置"
					},
					{
						img: "/static/img/guanyu.png",
						text: "关于"
					},
				],
				mioptionvalue: 1572864,
				optionCam: [{
					value: 1048576,
					label: '标清',
				}, {
					value: 1572864,
					label: '高清',
				}, {
					value: 2097152,
					label: '超清',
				}],
				localvideo: "",
				audioinput: "",
				audioinputValue: '',
				audiooutput: "",
				audiooutputValue: "",

				videoLsit: "",
				videoLsitValue: "",
				eliminate: true,
				gain: true,
				noise: true,
				checkboxCam: true,
				defslider: 0,
				slidervaluemic: 30,
				canValuemic: "",
				slidervalue: 50,
				navItemsUse: [],
				newItemNoUse: [],
				newItem: [],
				nisrue: [],
				navItemsNoUse: [],
				ismic: true,
				iscam: true
			};
		},
		created() {
			
			this.http('/app/config').then(res => {
				if (uni.getStorageSync('commNavs') && uni.getStorageSync('thatconfig')) {
					if (JSON.stringify(uni.getStorageSync('thatconfig')) === JSON.stringify(res.data
							.pcModuleList)) {
						this.coneg(uni.getStorageSync('commNavs'))
					} else {
						uni.setStorageSync('commNavs', '')
						this.coneg(res.data.pcModuleList)
					}
				} else {
					uni.setStorageSync('commNavs', '')
					this.coneg(res.data.pcModuleList)
				}
				uni.setStorageSync('thatconfig', res.data.pcModuleList)
			})


			uni.$off('updateMsg')
			uni.$on('updateMsg', (data) => {
				this.audioinput = audioinput
				this.audiooutput = audiooutput
			})

			this.audioinput = audioinput
			this.audiooutput = audiooutput
			this.videoLsit = videoLsit
		},
		methods: {
			download(){
				if(this.loading){
					var path = this.upurl
					flutter.call('runInstaller',{path}, (result, error) => {
						
					})
				}else{
					this.but_text = '正在下载中'
					this.loading=true
					var url = this.geturl('')+'/system/file/download'+this.versionData.windowsFilePath
					var automatic=false
					flutter.call('appUpgrade',{url,automatic}, (result, error) => {
						if(result){
							this.upurl= result
							this.text='新版本已下载完成，需重启应用即可使用'
							this.loading=false
							this.but_text = '立即安装重启'
						}else{
							this.loading=false
							this.but_text = '立即下载'
						}
					})
				}
				
			},
			onUpdate(){
				this.http('/app/version',{
				}).then(res=>{
					
					flutter.call('versionCode', {}, (result, error) => {
						if(res.data.pcVersionCode > result){
							
							this.but_text = '立即下载'
							this.upversion = res.data.pcVersionCode+'.0.0'
							this.versionData = res.data
							this.$refs.upDate.open()
							
							
							// uni.showModal({
							// 	content: '有新版，要下载更新吗？',
							// 	success: (res)=>{
							// 		if (res.confirm) {
							// 			uni.showToast({
							// 				title:"正在下载,请稍等",
							// 				icon:"none"
							// 			})
							// 			flutter.call('appUpgrade',{url,automatic}, (result, error) => {
							// 			})
							// 		} 
							// 	}
							// })
							
						}else{
							uni.showToast({
								title:"暂无更新",
								icon:"none"
							})
						}
					})
					
				})
			},
			onImgPath() {
				this.getPath().then(res => {
					this.IMG_PATH = res
				})
			},
			onVideoPath() {
				this.getPath().then(res => {
					this.vodel_path = res
				})
			},
			getPath() {
				return new Promise((resolve, reject) => {
					flutter.call('pickFilePath', {}, (result, error) => {
						if (error) {
							uni.showToast({
								title: error,
								icon: "none"
							})
							return
						}
						resolve(result)
					})
				})
			},
			changeIMG(val) {
				this.imgVlaue = val
			},

			changWinNumber(val) {
				this.winVlaue = val
			},
			changeFlowType(val) {
				this.typeVlaue = val
			},
			TAPiscam(e) {
				window.iscam = e
			},
			monitorSave() {
				let data = {
					winVlaue: this.winVlaue, //启动窗口数,
					typeVlaue: this.typeVlaue, //码流类型：
					box_alarm: this.box_alarm, //报警声音
					alarm_value: this.alarm_value, //报警声音关闭(秒)
					box_playback: this.box_playback, //即时回放
					playback_value: this.playback_value, //即时回放时间(秒)
					box_position: this.box_position, //持续获取云台位置
					box_prompt: this.box_prompt, //报警联动提示
					imgVlaue: this.imgVlaue, //图片格式：
					link_img_num: this.link_img_num, //连续抓图(张)
					link_img_second: this.link_img_second, //连续抓图间隔(秒)
					IMG_PATH: this.IMG_PATH, //抓图保存路径：
					max_time_video: this.max_time_video, //最大录像时间(分)
					vodel_path: this.vodel_path, //录像保存路径
				}
				uni.setStorageSync('monitorConfig', data)
				uni.showToast({
					title:"保存成功",
					icon:"none"
				})
				this.$refs.showpeizhi.close()
			},
			changemic(e) {
				window.ismic = e
			},
			onListUpdate(newList) {
				this.nisrue = newList
			},
			delItem(index) {
				if (this.navItemsUse.length < 3) {
					uni.showToast({
						title: '最少配置2个应用',
						icon: 'none'
					})
					return
				}
				this.navItemsUse[index].status = 0
				this.navItemsNoUse.unshift(this.navItemsUse[index])
				this.navItemsUse.splice(index, 1)
			},
			addItem(index) {
				this.navItemsNoUse[index].status = 1
				this.navItemsUse.push(this.navItemsNoUse[index])
				this.navItemsNoUse.splice(index, 1)
			},
			save() {
				let navItems
				if (this.nisrue.length) {
					this.newItem = this.nisrue

					this.navItemsUse = this.nisrue.concat(this.navItemsNoUse)
				} else {
					this.newItem = this.navItemsUse
					this.navItemsUse = this.navItemsUse.concat(this.navItemsNoUse)
				}
				uni.setStorageSync('commNavs', this.navItemsUse)
				this.$refs.showpeizhi.close()
				this.$emit('newItem', this.newItem)
			},
			coneg(res) {
				this.newItem = []
				this.navItemsUse = []
				this.newItemNoUse = []
				this.navItemsNoUse = []
				res.map(item => {
					if (item.status) {
						this.newItem.push(item)
						this.navItemsUse.push(item)
					} else {
						this.newItemNoUse.push(item)
						this.navItemsNoUse.push(item)
					}
				})
				this.$emit('newItem', this.newItem)
			},
			//关闭应用配置
			upclose(e) {
				if (!e.show) {
					let navall
					zjsdk3.local_dev_mute_cam(true)
					zjsdk3.preview_dev_finished()
					zjsdk3.preview_dev_open_micphone(null)
					if (uni.getStorageSync('commNavs')) {
						navall = uni.getStorageSync('commNavs')
					} else {
						navall = uni.getStorageSync('thatconfig')
					}
					this.coneg(navall)
				} else {
					this.iscam = iscam
					this.ismic = ismic
					this.sindex=2
					uni.$off('updateMsg')
					uni.$on('updateMsg', res => {
						this.audioinput=audioinput
						this.videoLsit=videoLsit
						if (audioinput.length) {
							audioinput.map(item => {
								if (item.is_default) {
									this.audioinputValue = item.device_id
								}
							})
						}else{
							this.audioinputValue =''
						}
					})
					this.audioinput=audioinput
					this.videoLsit=videoLsit
					if (audioinput.length) {
						audioinput.map(item => {
							if (item.is_default) {
								this.audioinputValue = item.device_id
							}
						})
					}else{
							this.audioinputValue =''
						}
						if (window.flutter) {
							flutter.call('getVolume', {}, (result, error) => {
								this.slidervaluemic = Math.round(result * 100)
							})
						}
				}

			},
			ISmirror(e) {
				window.checkboxCam = e
				var video = document.getElementById('previewVideo');
				video.style.transform = video.style.transform === "scaleX(-1)" ? "" : "scaleX(-1)";
			},
			micSelect(value) { //选择设备扬声器
				this.canValuemic = value
			},
			elSlider(value) { //输入等级
				if (value / 10 == 10) {
					this.slidervalue = 9
				} else {
					this.slidervalue = value / 10
				}
			},
			// playAudio() { //检测扬声器
			// 	zjsdk3.preview_dev_play_audio(this.canValuemic, this.slidervaluemic / 100)
			// },
			//输出音量
			sliderChange(e) {
				this.slidervaluemic = e.detail.value
				zjsdk3.local_dev_set_speaker_volume(e.detail.value / 100)
				
				if (flutter) {
					flutter.call('setVolume', {volume:(e.detail.value / 100).toFixed(1)}, (result, error) => {
					})
				}
			},
			micphone() { //检测麦克风

				zjsdk3.preview_dev_open_micphone(this.audioinputValue, res => {
					this.defslider = res * 10
				})
				// var num = zjsdk3.local_dev_get_mic_energy()
				// this.defslider = num * 10
			},
			//清晰度
			changepicker(option) {
				zjsdk3.options.local_send_bw = option
			},
			//回声消除
			// this.eliminate = zjsdk3.options.audio_use_aec == 1 ? true : false
			// this.gain = zjsdk3.options.audio_use_agc == 1 ? true : false
			// this.noise = zjsdk3.options.audio_use_gain == 1 ? true : false
			tapEliminate(type) {
				this.eliminate = type
				if (type) {
					zjsdk3.options.audio_use_aec = 0
				} else {
					zjsdk3.options.audio_use_aec = 1
				}
			},
			//自动增益控制
			tapGain(type) {
				this.gain = type
				if (type) {
					zjsdk3.options.audio_use_agc = 0
				} else {
					zjsdk3.options.audio_use_agc = 1
				}
			},
			//自动噪音抑制
			tapNoise(type) {
				this.noise = type
				if (type) {
					zjsdk3.options.audio_use_gain = 0
				} else {
					zjsdk3.options.audio_use_gain = 1
				}
			},
			camSelect(value) { //选择设备麦克风
				this.audioinputValue = value
				zjsdk3.local_dev_switch_mic(value)
			},
			async videoSelect(value) { //选择设备摄像头
				this.videoLsittValue = value
				zjsdk3.local_dev_switch_cam(value)
				let Videores = await zjsdk3.preview_dev_open_camera(value)
				this.localvideo = document.querySelector('#previewVideo')
				if (this.localvideo) {
					this.localvideo.srcObject = Videores
					this.localvideo.play()
				}
			},
			//应用配置左边却换
			async tapseeting(index) {
				this.sindex = index
				zjsdk3.preview_dev_open_micphone(null)
				if (index == 1) {
					this.iscam = iscam
					this.mioptionvalue = zjsdk3.options.local_send_bw
					this.videoLsitValue = videoLsit[0].device_id

					let Videores = await zjsdk3.preview_dev_open_camera(this.videoLsitValue)
					this.localvideo = document.querySelector('#previewVideo')
					if (this.localvideo) {
						this.localvideo.srcObject = Videores
						this.localvideo.play()
					}

				} else if (index == 2) {


					if (audioinput.length) {
						audioinput.map(item => {
							if (item.is_default) {
								this.audioinputValue = item.device_id
							}
						})
					}

					if (audiooutput.length) {
						audiooutput.map(item => {
							if (item.is_default) {
								this.audiooutputValue = item.device_id
							}
						})
					}
					this.eliminate = zjsdk3.options.audio_use_aec == 1 ? true : false
					this.gain = zjsdk3.options.audio_use_agc == 1 ? true : false
					this.noise = zjsdk3.options.audio_use_gain == 1 ? true : false

					if (flutter) {
						flutter.call('getVolume', {}, (result, error) => {
							this.slidervaluemic = Math.round(result * 100)
						})
					}


				} else if (index == 3){
					var  config= uni.getStorageSync('monitorConfig')
					if(config){
						this.winVlaue= config.winVlaue//启动窗口数,
						this.typeVlaue= config.typeVlaue //码流类型：
						this.box_alarm= config.box_alarm //报警声音
						this.alarm_value= config.alarm_value //报警声音关闭(秒)
						this.box_playback= config.box_playback //即时回放
						this.playback_value= config.playback_value //即时回放时间(秒)
						this.box_position= config.box_position //持续获取云台位置
						this.box_prompt= config.box_prompt //报警联动提示
						this.imgVlaue= config.imgVlaue //图片格式：
						this.link_img_num= config.link_img_num //连续抓图(张)
						this.link_img_second= config.link_img_second //连续抓图间隔(秒)
						this.IMG_PATH= config.IMG_PATH //抓图保存路径：
						this.max_time_video= config.max_time_video //最大录像时间(分)
						this.vodel_path= config.vodel_path //录像保存路径
					}
				}else{
					flutter.call('versionName', {}, (result, error) => {
						this.version = result
					})
				}
			},

			open() {
				this.$refs.showpeizhi.open()
			},
			close() {
				this.$refs.showpeizhi.close()
			},
		}
	}
</script>

<style>
	.drag-items {
		margin: 0 28rpx;

	}

	.drag-item {
		height: 70px;
		box-sizing: border-box;
		background-color: #f6f6f6;
		color: #333333;
		padding: 30rpx 32rpx;
		border-radius: 8rpx;
		margin-bottom:10px;
	}

	.del-icon {
		width: 58rpx;
		height: 10rpx;
	}

	.icon {
		width: 80rpx;
		margin: 0 32rpx 0 28rpx;
	}

	.drag-icon {
		width: 58rpx;
	}

	.width300 {
		width: 300rpx;
		text-align: left;
	}
	.bge0eaff{
		background: #e0eaff;
	}
</style>